version 8.2
capture clear
capture log close
set more off
set mem 1000m
set mat 800


****IATI data:
insheet using "IATI_judicial reforms_coding.csv"
ren recipientcountry countryname

*year:
gen temp=substr(startactual,7,4)
replace temp=substr(startplanned,7,4) if temp==""
gen year=real(temp)
drop temp
*browse startactual startplanned year 

*browse countryname year reform_access reform_speed reform_quality

sort countryname year
save "IATI_judicial reforms_coding_clean.dta", replace
clear

****Wold Bank data:

insheet using "World Bank_judicial reforms.csv"
*browse countryname year reform_access reform_speed reform_quality totalamt lendprojectcost


drop if countryname==""

local list_type_reform access speed quality
foreach var of local list_type_reform{
	ren reform_`var' reform_`var'_wb
	}
	
destring lendprojectcost, gen(totalcommitment_wb) ignore(";")	

***note: replace totalcommitment_wb=0 if we didn't code it as a judicial reform:
replace totalcommitment_wb=0 if reform_access==.&reform_speed==.&reform_quality==.

count
***50 judicial reforms
sort year
***Between 2006 and 2015
sum totalcommitment_wb
***average: 30 million dollars, max 300 million dollars
egen sum_wb=sum(totalcommitment_wb)
***total: 1.5 Billion dollars
drop sum_wb

sort countryname year

save "World Bank_judicial reforms_clean.dta", replace
clear


***Doing business data:
insheet using "Doing business reforms_clean.csv"

*browse countryname year reform_access reform_speed reform_quality

drop if countryname==""

local list_type_reform access speed quality
foreach var of local list_type_reform{
	ren reform_`var' reform_`var'_db
	}
	
sort countryname year
save "Doing business reforms_clean.dta", replace
clear



****USAID data:

insheet using "USAID_Rule of Law and Human Rights_clean.csv"

keep if reform_access==1|reform_speed==1|reform_quality==1
ren awardlocationname countryname
keep countryname reform_access reform_speed reform_quality awardtotalestimatedvalue awarddatestartdatedate
destring awardtotalestimatedvalue, gen(totalcommitment_usaid) ignore(",")	
drop awardtotalestimatedvalue

*browse

*year:
gen temp=substr(awarddatestartdatedate,7,4)
gen year=real(temp)
drop temp
 
keep countryname year reform_access reform_speed reform_quality totalcommitment_usaid

local list_type_reform access speed quality
foreach var of local list_type_reform{
	ren reform_`var' reform_`var'_usaid
	}


count
***61 judicial reforms
***But 4 are quite old (before 2007)
***So 57 judicial reforms that fit the criteria, ie that are started after the entreprise surveys
sort year
***Between 2008 and 2016
sum totalcommitment_usaid
***average: 14 million dollars, max 66 million dollars
egen sum_usaid=sum(totalcommitment_usaid)
***total: 676 million dollars
drop sum_usaid

sort countryname year
save "USAID_judicial reforms_clean.dta", replace
clear

*****Append all reforms together

use "IATI_judicial reforms_coding_clean.dta"
append using "World Bank_judicial reforms_clean.dta"
append using "Doing business reforms_clean.dta"
append using "USAID_judicial reforms_clean.dta"
save "all reforms.dta", replace


***Merging:

use "panel_data_clean3.dta"
append using "all reforms.dta"
gsort countryname -year h7a
***we gsort -year such that the code in the next lines build the "period" variable that identifies all reform done
***before or in the year of the data collection.

*browse countryname year h7a va_perwo reform_access if countryname=="Kenya"
*browse countryname year h7a va_perwo reform_access if countryname=="Bangladesh"
browse countryname year h7a va_perwo reform_access if countryname=="Albania"


***objective: build a variable called period which takes the value 1 in years in between enterprisesurveys
*and before the enterprise survey was collected
*and then 2 in the next period
***and so on...

***generate year of data in which enterprise surveys was collected:
gen year_data=year if h7a!=.|va_perwo!=.
replace year_data=year_data[_n-1] if year_data==.&countryname==countryname[_n-1]

***generate year when the last enterprise survey was collected
egen year_endline=max(year) if h7a!=., by(countryname)
egen year_endline2=mean(year_endline), by(countryname)

gen period=0
replace period=1 if countryname==countryname[_n-1]&year_data!=year_data[_n-1]
replace period=period+period[_n-1] if countryname==countryname[_n-1]

**Look at Kenya: enterprise survey collected in 2007 and 2013. Period=1 in all the years in between
**Look at Bangladesh: enterprise survey collected in 2007, 2011 and 2013. Period=1 in all the years in between 2007 and 2011; and equal to 2 in all the years in between 2011 and 2013

drop year_data year_endline year_endline2

****calculate the sum of the reforms
local list_type_reform access speed quality
foreach var of local list_type_reform{
	egen reform_`var'_sum=sum(reform_`var'), by (countryname period)

	*sum of budget for reform:
	egen temp=sum(totalcommitment) if reform_`var'==1, by (countryname period)
	egen reform_`var'_budget=max(temp), by (countryname period)
	replace reform_`var'_budget=0 if reform_`var'_budget==.
	
	*replace by missing if period==.
	replace reform_`var'_sum=. if period==.
	replace reform_`var'_budget=. if period==.
	
	drop temp
	}	

	
*browse countryname year h7a va_perwo reform_access totalcommitment reform_access_budget if countryname=="Bangladesh"
*browse countryname year h7a va_perwo reform_access totalcommitment reform_access_budget if countryname=="Albania"
*browse countryname year h7a va_perwo reform_access totalcommitment reform_access_budget if countryname=="Albania2"


	
****calculate the sum of the reforms WB
local list_type_reform access_wb speed_wb quality_wb
foreach var of local list_type_reform{
	egen reform_`var'_sum=sum(reform_`var'), by (countryname period)
	
	*sum of budget for WB reform:
	egen temp=sum(totalcommitment_wb) if reform_`var'==1, by (countryname period)
	egen reform_`var'_budget=max(temp), by (countryname period)
	replace reform_`var'_budget=0 if reform_`var'_budget==.

	*replace by missing if period==.
	replace reform_`var'_sum=. if period==.
	replace reform_`var'_budget=. if period==.

	drop temp
	}	


****calculate the sum of the reforms USAID
local list_type_reform access_usaid speed_usaid quality_usaid
foreach var of local list_type_reform{
	egen reform_`var'_sum=sum(reform_`var'), by (countryname period)
	
	*sum of budget for USAID reform:
	egen temp=sum(totalcommitment_usaid) if reform_`var'==1, by (countryname period)
	egen reform_`var'_budget=max(temp), by (countryname period)
	replace reform_`var'_budget=0 if reform_`var'_budget==.

	*replace by missing if period==.
	replace reform_`var'_sum=. if period==.
	replace reform_`var'_budget=. if period==.

	drop temp
	}	

	
****calculate the sum of the reforms DB
local list_type_reform access_db speed_db quality_db
foreach var of local list_type_reform{
	egen reform_`var'_sum=sum(reform_`var'), by (countryname period)
	replace reform_`var'_sum=. if period==.
	}	
	
****calculate total budget
egen temp=sum(totalcommitment), by (countryname period)
egen reform_budget=max(temp), by (countryname period)
replace reform_budget=. if period==.
drop temp
*In million dollars:
replace reform_budget=reform_budget/1000000

	
****calculate total budget WB
egen temp=sum(totalcommitment_wb), by (countryname period)
egen reform_wb_budget=max(temp), by (countryname period)
replace reform_wb_budget=. if period==.
drop temp
*In million dollars:
replace reform_wb_budget=reform_wb_budget/1000000
		
****calculate total budget usaid
egen temp=sum(totalcommitment_usaid), by (countryname period)
egen reform_usaid_budget=max(temp), by (countryname period)
replace reform_usaid_budget=. if period==.
drop temp
*In million dollars:
replace reform_usaid_budget=reform_usaid_budget/1000000


keep if h7a~=.|va_perwo!=.

/*

browse countryname year h7a va_perwo reform_budget reform_wb_budget reform_usaid_budget if countryname=="Bangladesh"
browse countryname year h7a va_perwo reform_budget reform_wb_budget reform_usaid_budget if countryname=="Kenya"
browse countryname year h7a va_perwo reform_budget reform_wb_budget reform_usaid_budget if countryname=="El Salvador"
browse countryname year h7a va_perwo reform_budget reform_wb_budget reform_usaid_budget if countryname=="Lao PDR"
browse countryname year h7a va_perwo reform_access_budget reform_access_wb_budget reform_access_usaid_budget if countryname=="Bangladesh"
*/

browse countryname year h7a va_perwo reform_budget reform_wb_budget reform_usaid_budget if countryname=="Albania"

***Note: the data is for the period in between the year and the next year

*Calculate duration between two waves:
sort countryname year
gen duration=year-year[_n-1] if countryname==countryname[_n-1]

***generate dummies for reforms that takes the value 1 only if a reform is started in between the years of an enterprise survey:

local list_type_reform access speed quality access_wb speed_wb quality_wb access_usaid speed_usaid quality_usaid
foreach var of local list_type_reform{
drop reform_`var'

replace reform_`var'_sum=reform_`var'_sum/duration

***dichotomous variable for reform:
gen reform_`var'_dum=1 if reform_`var'_sum>0&reform_`var'_sum!=.
replace reform_`var'_dum=0 if reform_`var'_sum==0|reform_`var'_sum==.

***Budget reforms per year:
replace reform_`var'_budget=reform_`var'_budget/duration
*In million dollars:
replace reform_`var'_budget=reform_`var'_budget/1000000
replace reform_`var'_budget=0 if countryname!=countryname[_n-1]


}

browse countryname year h7a va_perwo reform_access_usaid_dum if countryname=="Albania"
browse countryname year h7a va_perwo reform_access_usaid_dum if countryname=="Armenia"



***generate dummies for reforms DB:
local list_type_reform access_db speed_db quality_db
foreach var of local list_type_reform{
drop reform_`var'

***sum of all reforms per year:
replace reform_`var'_sum=reform_`var'_sum/duration

***dichotomous variable for reform:
gen reform_`var'_dum=1 if reform_`var'_sum>0&reform_`var'_sum!=.
replace reform_`var'_dum=0 if reform_`var'_sum==0


}




gen reform_dum=1 if reform_access_dum==1|reform_speed_dum==1|reform_quality_dum==1
replace reform_dum=0 if reform_dum==.

gen reform_sum=reform_access_sum+reform_speed_sum+reform_quality_sum

*browse countryname year reform_dum reform_sum reform_budget if countryname=="Bangladesh"


***Budget reforms:
*per year:
replace reform_budget=reform_budget/duration


*browse countryname year reform_dum reform_sum reform_budget if countryname=="Bangladesh"
*browse countryname year reform_dum reform_sum reform_budget if countryname=="Albania"


***same for world bank and USAID:
local list_donor wb usaid
foreach var of local list_donor{

gen reform_`var'_dum=1 if reform_access_`var'_dum==1|reform_speed_`var'_dum==1|reform_quality_`var'_dum==1
replace reform_`var'_dum=0 if reform_`var'_dum==.

gen reform_`var'_sum=reform_access_`var'_sum+reform_speed_`var'_sum+reform_quality_`var'_sum

***Budget reforms:
*per year:
replace reform_`var'_budget=reform_`var'_budget/duration

}

*browse countryname year reform_dum reform_sum reform_budget  reform_wb_dum reform_wb_sum reform_wb_budget if countryname=="Bangladesh"


***same for Doing Business:
gen reform_db_dum=1 if reform_access_db_dum==1|reform_speed_db_dum==1|reform_quality_db_dum==1
replace reform_db_dum=0 if reform_db_dum==.

gen reform_db_sum=reform_access_db_sum+reform_speed_db_sum+reform_quality_db_sum

*browse countryname year duration reform_budget

*browse countryname year post court_good_small reform_access_sum reform_access_dum reform_access_dum_post if countryname=="Kenya"
*browse countryname year post court_good_small reform_access_sum reform_access_dum reform_access_dum_post if countryname=="Angola"
*browse countryname year post court_good_small reform_access_sum reform_access_dum reform_access_dum_post if countryname=="Cambodia"

*browse countryname year post court_good_small reform_access_dum reform_speed_dum reform_quality_dum
*browse countryname year post court_good_small reform_access_sum reform_speed_sum reform_quality_sum reform_sum
*browse countryname year post court_good reform_access_budget reform_speed_budget reform_quality_sum reform_budget

sort countryname year
egen year_baseline=min(year), by(countryname)

tab reform_dum if year!=year_baseline, missing 
*40 countries out of 135 have a judicial reform
tab reform_sum if year!=year_baseline, missing
 
*hist reform_budget if year!=year_baseline
*hist reform_budget if year!=year_baseline & reform_budget < 50

sum reform_budget if year!=year_baseline
sum reform_budget if year!=year_baseline & reform_budget>0 & reform_budget!=.
**take out Afhghanistan, a clear outlier
sum reform_budget if year!=year_baseline & reform_budget>0 & reform_budget!=. & countryname!="Afghanistan"

***replace budget by zero if no reform:

replace reform_budget=0 if reform_dum==0
replace reform_wb_budget=0 if reform_wb_dum==0
replace reform_usaid_budget=0 if reform_usaid_dum==0


local list_type_reform access speed quality access_wb speed_wb quality_wb access_usaid speed_usaid quality_usaid
foreach var of local list_type_reform{
	replace reform_`var'_budget=0 if reform_`var'_dum==0
	}

*browse countryname year reform_dum reform_sum reform_budget  reform_wb_dum reform_wb_sum reform_wb_budget if countryname=="Bangladesh"
*browse countryname year reform_dum reform_sum reform_budget  reform_wb_dum reform_wb_sum reform_wb_budget if countryname=="Albania"


*sort reform_budget
*browse countryname reform_budget


sort countryname year
merge countryname year using "GDP per capita_clean2.dta"
***drop the observations in World Development indicators but not in Entreprise surveys
drop if _merge==2
drop _merge

sort countryname year
merge countryname year using "Foreign aid_clean.dta"
***drop the observations in World Development indicators but not in Entreprise surveys
drop if _merge==2
drop _merge

sort countryname year
merge countryname year using "Doing business_Full data_clean.dta"
*browse countryname year court_good_small dtf _merge
drop if _merge==2
drop _merge

sort countryname year
merge countryname year using "PPP exchange rate2_clean.dta"
*browse countryname year h7a dtf _merge pppconversionfactorgdplcuperinte
drop if _merge==2
drop _merge


*now merge with polity IV
sort countryname 
merge countryname using "Polity IV.dta"
*browse countryname year court_good_small polity2 _merge
drop if _merge==2
drop _merge

*now merge with other reforms from IATI
sort countryname 
merge countryname using "Enterprise surveys_Other_reforms.dta"
*browse countryname year court_good_small reform_education_budget_gdp _merge
drop if _merge==2
drop _merge

*now merge with Budget judiciary
sort countryname 
merge countryname using "Budget.dta"
*browse countryname year budget_us _merge
drop if _merge==2
drop _merge

*now merge with pbetaT-l:
sort countryname 
merge countryname using "Doing business_p_betaT_l.dta"
*browse countryname year sueing_condition _merge
drop if _merge==2
drop _merge


*browse if countryname=="Albania"
*browse if countryname=="Kenya"
*browse countryname year  pppconversionfactorgdplcuperinte

*****need a better indicator of GDP, lots of missing variables

*reform_budget is in million dollars:
gen reform_budget_gdp=reform_budget*1000000/gdppppconstant2011internationaln
*browse reform_budget_gdp reform_budget gdppppconstant2011internationaln if countryname=="Kenya"


****reform_budget as a proportion of budget judiciary
***median budget judicairy OECD=0.2% (see OECD FINAL Civil Justice Policy Paper.pdf in budget judiciary)
gen reform_budget_jud=reform_budget*1000000/(0.2/100*gdppppconstant2011internationaln)
*browse reform_budget_gdp reform_budget gdppppconstant2011internationaln reform_budget_jud if countryname=="Kenya"
*hist reform_budget_jud if year!=year_baseline
*hist reform_budget_jud if year!=year_baseline & reform_budget_jud<=1
*hist reform_budget_jud if year!=year_baseline & reform_budget_jud>=1&reform_budget_jud<=2
*sort reform_budget_jud



gen reform_dum_big1=1 if reform_budget_jud>=0.05&reform_budget_jud!=.&(reform_access_dum==1&reform_speed_dum==1&reform_quality_dum==1)
replace reform_dum_big1=0 if reform_dum_big1==.
gen reform_dum_big1_post=reform_dum_big1*post

/*now generate small reforms: 
-No world bank, no usaid
-piecemeal reforms
-small budget
*/

gen reform_dum_small1=1 if reform_dum==1 & (reform_wb_dum==0 & reform_usaid_dum==0) & ((reform_budget_jud>=0&reform_budget_jud<0.05)|(reform_access_dum==0|reform_speed_dum==0|reform_quality_dum==0))
*Small = A reform AND (not WB, not USAID) AND (small budget OR one criteria missing)
replace reform_dum_small1=0 if reform_dum_small1==.

*Budget: 3%
gen reform_dum_big2=1 if reform_budget_jud>=0.03&reform_budget_jud!=.&(reform_access_dum==1&reform_speed_dum==1&reform_quality_dum==1)
replace reform_dum_big2=0 if reform_dum_big2==.
gen reform_dum_big2_post=reform_dum_big2*post

gen reform_dum_small2=1 if reform_dum==1 & (reform_wb_dum==0 & reform_usaid_dum==0) & ((reform_budget_jud>=0&reform_budget_jud<0.03)|(reform_access_dum==0|reform_speed_dum==0|reform_quality_dum==0))
replace reform_dum_small2=0 if reform_dum_small2==.

*Budget: 7%
gen reform_dum_big3=1 if reform_budget_jud>=0.07&reform_budget_jud!=.&(reform_access_dum==1&reform_speed_dum==1&reform_quality_dum==1)
replace reform_dum_big3=0 if reform_dum_big3==.
gen reform_dum_big3_post=reform_dum_big3*post

gen reform_dum_small3=1 if reform_dum==1 & (reform_wb_dum==0 & reform_usaid_dum==0) & ((reform_budget_jud>=0&reform_budget_jud<0.07)|(reform_access_dum==0|reform_speed_dum==0|reform_quality_dum==0))
replace reform_dum_small3=0 if reform_dum_small3==.


*Budget: 1%
gen reform_dum_big4=1 if reform_budget_jud>=0.01&reform_budget_jud!=.&(reform_access_dum==1&reform_speed_dum==1&reform_quality_dum==1)
replace reform_dum_big4=0 if reform_dum_big4==.
gen reform_dum_big4_post=reform_dum_big4*post

gen reform_dum_small4=1 if reform_dum==1 & (reform_wb_dum==0 & reform_usaid_dum==0) & ((reform_budget_jud>=0&reform_budget_jud<0.01)|(reform_access_dum==0|reform_speed_dum==0|reform_quality_dum==0))
replace reform_dum_small4=0 if reform_dum_small4==.



forvalues i=1(1) 4{
	gen reform_dum`i'=1 if reform_wb_dum==1|reform_usaid_dum==1|reform_dum_big`i'==1
	*reform_wb_dum==1|reform_usaid_dum==1|reform_dum_big`i'==1
	replace reform_dum`i'=0 if reform_dum`i'==.

	
	gen reform_step`i'=reform_dum`i'
	replace reform_step`i'=reform_step`i'+reform_step`i'[_n-1] if countryname==countryname[_n-1]
	replace reform_step`i'=1 if reform_step`i'>=1&reform_step`i'!=.

	gen reform_pre`i'=1 if reform_dum`i'[_n+1]==1 & reform_step`i'==0 & countryname==countryname[_n+1]
	replace reform_pre`i'=0 if reform_pre`i'==.

	gen reform_long`i'=1 if reform_dum`i'[_n-1]==1 & reform_dum`i'==0 & countryname==countryname[_n-1]
	replace reform_long`i'=0 if reform_long`i'==.

	****Any reform:
	egen reform_any`i'=max(reform_dum`i'), by(countryname)	
	
	*sum of reforms:
	egen reform_sum`i'=rowtotal(reform_wb_dum reform_usaid_dum reform_dum_big`i')
		
	gen reform_access_dum`i'=1 if reform_access_dum==1|reform_access_wb_dum==1|reform_access_usaid_dum==1
	gen reform_speed_dum`i'=1 if reform_speed_dum==1|reform_speed_wb_dum==1|reform_speed_usaid_dum==1
	gen reform_quality_dum`i'=1 if reform_quality_dum==1|reform_quality_wb_dum==1|reform_quality_usaid_dum==1
	}

browse countryname year reform_dum4  if countryname=="Armenia"
browse countryname year reform_dum4  if countryname=="Congo, Dem. Rep."
browse countryname year reform_dum4 



	
*gsort -reform_dum1
*browse countryname reform_dum1  reform_access_dum1 reform_speed_dum1 reform_quality_dum1 if post==1

*gsort -reform_dum2
*browse countryname reform_dum2  reform_access_dum2 reform_speed_dum2 reform_quality_dum2 if post==1

*gsort -reform_dum3
*browse countryname reform_dum3  reform_access_dum3 reform_speed_dum3 reform_quality_dum3 if post==1


 
****Same for world bank and usaid:

local list_donor wb usaid
foreach var of local list_donor{

*reform_budget is in million dollars:
gen reform_`var'_budget_gdp=reform_`var'_budget*1000000/gdppppconstant2011internationaln
*browse reform_`var'_budget_gdp reform_`var'_budget gdppppconstant2011internationaln if countryname=="Kenya"

****reform_`var'_budget as a proportion of budget jud
***median budget judicairy OECD=0.2%
gen reform_`var'_budget_jud=reform_`var'_budget*1000000/(0.2/100*gdppppconstant2011internationaln)
*browse reform_`var'_budget_gdp reform_`var'_budget gdppppconstant2011internationaln reform_`var'_budget_jud if countryname=="Kenya"


*browse reform_budget_jud reform_`var'_budget_gdp reform_`var'_budget gdppppconstant2011internationaln reform_`var'_budget_jud if countryname=="Afghanistan"

*hist reform_`var'_budget_jud if post==1

}



***For each type of reform
local list_type_reform access speed quality access_wb speed_wb quality_wb access_usaid speed_usaid quality_usaid
foreach var of local list_type_reform{
	***Budget reforms per year:
	gen reform_`var'_gdp=reform_`var'_budget*1000000/gdppppconstant2011internationaln

	****reform_budget as a proportion of budget judiciary
	gen reform_`var'_jud=reform_`var'_budget*1000000/(0.2/100*gdppppconstant2011internationaln)

	}

*browse countryname year duration reform_budget_gdp reform_budget_gdp_post reform_access_gdp reform_access_gdp_post reform_budget reform_access_gdp gdppppconstant2011internationaln if countryname=="Kenya"

label variable reform_budget "Budget of judicial reforms per year in million dollars"
label variable reform_budget_gdp "Budget of judicial reforms (as a fraction of GDP)"
label variable reform_budget_jud "Budget of judicial reforms (as a fraction of judiciary's budget)"


egen reform_budget_jud2=rowtotal(reform_budget_jud reform_wb_budget_jud reform_usaid_budget_jud)
label variable reform_budget_jud2 "Total budget of judicial reforms (as a fraction of judiciary's budget)"




*sort reform_budget_gdp
*browse countryname reform_budget_gdp

*browse countryname year reform_dum reform_budget gdppppconstant2011internationaln

*browse countryname year reform_dum reform_budget_jud reform_wb_dum reform_wb_budget_jud if post==1

***Create a measur of foreign aid per gdp
gen foreign_aid_gdp=foreign_aid/gdppppconstant2011internationaln
gen foreign_aid_percap=foreign_aid/populationtotalsppoptotl
 
gen foreign_aid2=foreign_aid
replace foreign_aid2=0 if foreign_aid2==.
gen foreign_aid2_gdp=foreign_aid2/gdppppconstant2011internationaln
gen foreign_aid2_percap=foreign_aid2/populationtotalsppoptotl

sort countryname year
*browse countryname year foreign_aid gdppppconstant2011internationaln foreign_aid_gdp foreign_aid_percap foreign_aid2_gdp foreign_aid2_percap



***Now create a dataset to be merged with microdata:
keep countryname year reform_dum reform_sum ///
 reform_dum1 reform_dum2 reform_dum3 reform_dum4 /// 
 log_gdppercapita2 log_s log_ngd log_school foreign_aid foreign_aid_gdp foreign_aid_percap foreign_aid2 foreign_aid2_gdp foreign_aid2_percap dtf pppconversionfactorgdplcuperinte ///
 polity2 Autocracy Anocracy Democracy ///
 reform_* ///
 sueing_condition no_renegotiation_condition

*browse countryname year court_good reform_dum2_post if countryname=="Sweden"|countryname=="Estonia"|countryname=="Czech Republic" ///
|countryname=="Slovak Republic"|countryname=="Slovenia"|countryname=="Hungary"|countryname=="Poland"

sort countryname year
browse countryname year reform_step4




sort countryname year
save "Enterprise surveys_earlier waves_judicial_reforms_for merge with earlier waves.dta", replace

exit

